package com.yang.controller;

import com.yang.pojo.ResultBody;
import com.yang.pojo.Sex;
import com.yang.service.SexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SexController {

    @Autowired
  private SexService sexService;

    @GetMapping("/selectSexNumAndSex")
    @ResponseBody
    @CrossOrigin(origins = "*",maxAge = 3600)
    public ResultBody selectSexNumAndSex(){
        List<Sex> sexes = sexService.allMale();
        return ResultBody.ok().data("sexNumAndSex",sexes);
    }
}
